# Contributor: Leon ROUX <leon.roux@federate.us>
# Maintainer: Leon ROUX <leon.roux@federate.us>
pkgname=supercollider
pkgver=3.13.0
pkgrel=4
pkgdesc="An audio server, programming language, and IDE for sound synthesis and algorithmic composition."
url="https://supercollider.github.io/"
arch="x86_64 x86 aarch64 armv7 armhf" # blocked by qt5-qtwebengine
license="GPL-3.0-or-later"
depends="git"
makedepends="
	alsa-lib-dev
	boost-dev
	boost-static
	cmake
	eudev-dev
	fftw-dev
	jack-dev
	libsndfile-dev
	libxt-dev
	linux-headers
	ncurses-dev
	portaudio-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtsvg-dev
	qt5-qttools-dev
	qt5-qtwebengine-dev
	qt5-qtwebsockets-dev
	readline-dev
	samurai
	yaml-cpp-dev
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev"
source="https://github.com/supercollider/supercollider/releases/download/Version-$pkgver/SuperCollider-$pkgver-Source.tar.bz2
	00-fortified-headers.patch
	"
builddir="$srcdir/SuperCollider-$pkgver-Source"

export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=2000000"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DFORTIFY=ON \
		-DSYSTEM_BOOST=ON \
		-DSYSTEM_YAMLCPP=ON \
		-DSYSTEM_PORTAUDIO=ON \
		-DSC_ABLETON_LINK=OFF \
		-DNATIVE=OFF \
		-DSC_EL=OFF
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
a60a128f7646f077f91adae666fa4014529aa9df78cf0dfe5d68c9bd6447f008af7da2970b8736f3f29d0adbaf67bce680a8201fcbe7e1aba29c3499a57f89cd  SuperCollider-3.13.0-Source.tar.bz2
cef3e1bdaecd4278d14fcabc39d2a69cfab1216ff3dedd3e54997470955dd310e502732ff2c0f76e95f349c31deb964eff456f49f51d7e3c83421521d0c30c43  00-fortified-headers.patch
"
